<?php defined('BASEPATH') OR exit('No direct script access allowed');

/**
 * Example
 *
 * This is an example of a few basic user interaction methods you could use
 * all done with a hardcoded array.
 *
 * @package		CodeIgniter
 * @subpackage	Rest Server
 * @category	Controller
 * @author		Phil Sturgeon
 * @link		http://philsturgeon.co.uk/code/
*/

// This can be removed if you use __autoload() in config.php OR use Modular Extensions
require APPPATH.'/libraries/REST_Controller.php';

class userhasrole extends REST_Controller
{
    
    function insert_put()
    {
    	if(!$this->put('user_id') || !$this->put('role_id'))
    	{
    		$this->response(NULL, 400);
    	}
    	$this->load->model('userhasroledao');
    	$role = $this->userhasroledao->insert_role_to_user($this->put('user_id'),$this->put('role_id'));
    	if($role != 0){
    		$this->response(array('status'=>"success"), 200); // 200 being the HTTP response code
    	} else {
    		$this->response(array('status'=>"false"), 200); // 200 being the HTTP response code
    	}
    }
}